package com.rm.zeyou.config.systemconfig;//package com.rm.zeyou_template.config.systemconfig;

import com.rm.zeyou.util.redis.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;


/**
 * @Author ZhangKeChen  🤙🤙🏼🤙🏽
 * @Date 2022/11/28
 * @Description 项目启动调用类
 */
@Slf4j
@Component
public class ReadSystemGlobalConfig {

    @Resource
    private RedisUtil redisUtil;

    @PostConstruct
    public void ReadSystemGlobalConfigMethod() {
        //log.info("==========================项目启动，加载读取全局项目配置开始==========================");
        //
        //String publicKeyStr = redisUtil.hget("RSA", CommonConstants.publicKeyStr);
        //
        //String privateKeyStr = redisUtil.hget("RSA", CommonConstants.privateKeyStr);
        //if (CheckEmptyUtil.isEmpty(publicKeyStr) || CheckEmptyUtil.isEmpty(privateKeyStr)) {
        //    Map<String, String> keyMap = RsaUtil.generateKey();
        //    publicKeyStr = keyMap.get(CommonConstants.publicKeyStr);
        //    privateKeyStr = keyMap.get(CommonConstants.privateKeyStr);
        //    redisUtil.hset("RSA", CommonConstants.publicKeyStr, publicKeyStr);
        //    redisUtil.hset("RSA", CommonConstants.privateKeyStr, privateKeyStr);
        //}
        //log.info("==========================项目启动，加载读取全局项目配置结束==========================");

    }
}

